package com.qf.first.service.impl;

import com.qf.first.dao.CategoryMapper;
import com.qf.first.entity.Category;
import com.qf.first.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    private CategoryMapper categoryMapper;
    @Override
    public List<Category> findCategoriesByShopId(Long shopId) {
        List<Category> categories = categoryMapper.findCategoriesByShopId(shopId);
        return categories;
    }

    @Override
    public String deleteCategory(Category category) {
        categoryMapper.deleteCategory(category);
        return "删除成功";
    }

    @Override
    public String addCategory(Category category) {
        categoryMapper.addCategory(category);
        return "添加成功";
    }

    @Override
    public List<Category> findAllCategories() {
        List<Category> allCategories = categoryMapper.findAllCategories();
        return allCategories;
    }
}
